package cn.gok.controller;

import cn.gok.service.SqlService;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping(value = "/")
public class SqlController {

    @PostMapping(value = "/bind")
    @ResponseBody
    public JSONObject bind(@RequestBody JSONObject json){
//        }
        SqlService sqlService=new SqlService();
        return sqlService.link(json);
    }
//    根据发来的sql语句，进行验证
    @PostMapping(value = "/validation")
    @ResponseBody
    public JSONObject validation(@RequestBody JSONObject json){
        SqlService sqlService=new SqlService();
        return sqlService.selvalidation(json);
    }
}
